package first.c01;

public class Movie {

	public final static int CHILDRENS = 2;
	public final static int NEW_RELEASE = 1;
	public final static int REGULAR = 0;

	private String title;

	private PriceCode _price;

	public Movie(String title, int price) {
		this.title = title;
		setPriceCode(price);
	}

	public String getTitle() {
		return title;
	}

	public void setTitle(String title) {
		this.title = title;
	}

	public int getPriceCode() {
		return _price.getPriceCode();
	}

	public void setPriceCode(int priceCode) {
		switch (priceCode) {
		case CHILDRENS:
			_price = new ChildRens();
			break;
		case NEW_RELEASE:
			_price = new NewRelease();
			break;
		case REGULAR:
			_price = new Regular();
			break;
		default:
			throw new IllegalArgumentException("Incorrect Price Code");
		}
	}

	public double getCharge(int daysRented) {
		double result = _price.getCharge(daysRented);
		return result;
	}

	public int getFrequentRenterPoints(int daysRented) {
		return _price.getFrequentRenterPoints(daysRented);
	}

}
